const express=require('express');
const router=express.Router();
const {login}=require('../service/loginService');

router.post('/login',async function(req,res,next){
 const data=await login(req.body);
 if(data.token){
   req.session.user = data.token;
 }
 res.send(data);
})

module.exports=router;